package com.woniu.orderservice.service.impl;

import com.woniu.orderservice.entity.Orderinfos;
import com.woniu.orderservice.dao.OrderinfosDao;
import com.woniu.orderservice.service.OrderinfosService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("orderinfosService")
public class OrderinfosServiceImpl implements OrderinfosService {
    @Resource
    private OrderinfosDao orderinfosDao;

    @Override
    public Orderinfos queryById(Integer id) {
        return orderinfosDao.queryById(id);
    }

    @Override
    public List<Orderinfos> queryAllByLimit(int offset, int limit) {
        return orderinfosDao.queryAllByLimit(offset, limit);
    }
   
     @Override
    public List<Orderinfos> findAll() {
        return orderinfosDao.findAll();
    }

    @Override
    public Orderinfos insert(Orderinfos orderinfos) {
        orderinfosDao.insert(orderinfos);
        return orderinfos;
    }

    @Override
    public Orderinfos update(Orderinfos orderinfos) {
        orderinfosDao.update(orderinfos);
        return queryById(orderinfos.getId());
    }

    @Override
    public boolean deleteById(Integer id) {
        return orderinfosDao.deleteById(id) > 0;
    }
}